home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC-SIG: World of Education
/
PC-SiG's World of Education.iso
/
run
/
2602
/
car.alg
< prev
next >
Wrap
Text File
|
1990-08-12
|
2KB
|
79 lines
{ CAR.ALG - algorithm to process car mileage data }
step = 1;
yformat=nominal;
xformat = dates;
interp = off;
file = "car.dat";
mileage = read & delta_miles = delta(mileage) &
tank_dist = avg(delta_miles) & max_dist = max(delta_miles) &
gas = read &
gas_cost = sum(read);
tmpstart = startval; tmpdur = durval;
ymin = 0; ymax = 500;
label = "'85 Porsche 944 1. Miles per tank of gas 2. Avg. Miles per tank";
ylabel = "Miles";
xlabel = "Date";
plot(delta_miles) & plot(tank_dist);
constant(tank_dist);
text = "Avg. miles per tank: ";
note(tank_dist,xposn(0.1),yposn(.15));
constant(max_dist);
text = "Max. miles per tank: ";
note(max_dist,xposn(0.1),yposn(.2));
pause;
erase;
ymax = 40;
ylabel = "Miles Per Gallon";
label = "'85 Porsche 944 1. MPG 2. Gallons of gasoline 3. Average MPG";
mpg = delta_miles / gas & std_mpg = std.dev(mpg) &
avg_mpg = avg(mpg) & max_mpg = max(mpg) &
plot(mpg) & plot(gas);
constant(std_mpg);
constant(avg_mpg);
oldstep = stepval;
step=durval;
plot(avg_mpg) & plot(avg_mpg + 3*std_mpg) & plot(avg_mpg - 3*std_mpg);
step = oldstep;
constant(max_mpg);
text = "Avg. MPG: ";
note(avg_mpg,xposn(0.1),yposn(.15));
text = "Max. MPG: ";
note(max_mpg,xposn(0.1),yposn(.2));
pause;
erase;
label="Total Gasoline Cost";
ylabel = "Dollars";
ymin=0; ymax=2000;
plot(gas_cost);
constant(gas_cost);
text = "Total gas cost: $";
note(gas_cost,xposn(0.1),yposn(.95));
pause;
erase;
label="Fillup Distribution - Gallons of Gas per Fillup";
ylabel = "Number of Fillups";
xlabel = "Gallons per Fillup";
xformat=nominal;
mxgal = 20; mngal = 10; binsize = .5;
binset((mxgal-mngal)/binsize,mngal,mxgal);
bincnt(gas);
trace = vline;
plot(bin(t));
pause;
erase;
step=1; start = tmpstart; dur = tmpdur;
label="Miles Per Gallon Distribution";
ylabel = "Number of Times";
xlabel = "Miles Per Gallon";
xformat=nominal;
binset(50,10,30);
bincnt(mpg);
plot(bin(t));